package cn.zfs.datasource.service;

import cn.zfs.datasource.advice.GlobalException;
import cn.zfs.datasource.entity.model.DataSourceProperties;
import cn.zfs.datasource.entity.vo.DataSourceVO;
import cn.zfs.datasource.util.BaseResponse;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

/**
 * @Author 张富生 wb.fusheng.zhang@renren-inc.com
 * @Date: Create Time 2018-04-02 14:22
 */
@SuppressWarnings("JavaDoc")
public interface DataSourceSevice {
    /**
     * 对数据库全部的表生成model
     *
     * @param response
     * @param dataSourceVO
     * @return
     * @throws SQLException
     * @throws IOException
     */
    BaseResponse createModel(HttpServletRequest request, HttpServletResponse response, DataSourceVO dataSourceVO) throws SQLException, IOException;

    BaseResponse createDao(HttpServletRequest request, HttpServletResponse response, DataSourceVO dataSourceVO) throws SQLException, GlobalException, IOException;

    BaseResponse getTableNames(HttpServletRequest request, int pageSize, int pageNum, String tableName) throws SQLException;

    BaseResponse testConnection(HttpServletRequest request, DataSourceProperties dataSourceProperties) throws SQLException;
}
